181A - Series of Crimes - CodeForces Solution


brute force geometry implementation *800

Please click on ads to support us..

Python Code:

x = y = 0
n, _ = map(int, input().split())
 
for i in range(n):
    for j, ch in enumerate(input()):
        if ch == '*':
            x, y = x^i, y^j
 
print(x+1, y+1)

	 			 	      	 	 				 			 				

C++ Code:

#include <bits/stdc++.h>

using namespace std;

#define IOF ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#define ll long long
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define sz(x) x.size()

const int N = 1e5 + 5;

int countStar(string s) {
    return count(all(s), '*');
}


int main() {
    IOF

    pair<int, int> p[3];

    int n, m;
    cin >> n >> m;

    vector<string> v(n);

    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    pair<int, int> p1, p2, p3;

    for (int i = 0; i < n; ++i) {
        int cnt = count(all(v[i]), '*');
        if (cnt == 1) {
            p1.fi = i + 1;
            p1.se = v[i].find('*') + 1;
        } else if (cnt == 2) {
            p2.fi = i + 1;
            p2.se = v[i].find('*') + 1;

            p3.fi = i + 1;
            p3.se = v[i].find('*', p2.se) + 1;
        }
    }

    cout << p1.fi << ' ';
    cout << (p2.se == p1.se ? p3.se : p2.se);


    return 0;
}
   				 	  	 	  		    		  	


Comments

Submit
0 Comments
More Questions

1618C - Paint the Array
469A - I Wanna Be the Guy
1294A - Collecting Coins
1227A - Math Problem
349A - Cinema Line
47A - Triangular numbers
1516B - AGAGA XOOORRR
1515A - Phoenix and Gold
1515B - Phoenix and Puzzle
155A - I_love_username
49A - Sleuth
1541A - Pretty Permutations
1632C - Strange Test
673A - Bear and Game
276A - Lunch Rush
1205A - Almost Equal
1020B - Badge
1353A - Most Unstable Array
770A - New Password
1646B - Quality vs Quantity
80A - Panoramix's Prediction
1354B - Ternary String
122B - Lucky Substring
266B - Queue at the School
1490A - Dense Array
1650B - DIV + MOD
1549B - Gregor and the Pawn Game
553A - Kyoya and Colored Balls
1364A - XXXXX
1499B - Binary Removals